<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>[%$softtitle%]</title>
<link href="templates/css/baselist.css" rel="stylesheet" type="text/css" />
<link href="templates/css/all.css" rel="stylesheet" type="text/css" />
<link href="templates/css/formdiv.css" rel="stylesheet" type="text/css"/>
<link href="templates/css/prettyPhoto.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/control.js"></script>
<script type="text/javascript" src="js/form.js"></script>
<script type="text/javascript" language="JavaScript">
	var filemanage_filecheck_select_allno = "[%$ST.filemanage_filecheck_select_allno%]";
	var filemanage_filecheck_select_max = "[%$ST.filemanage_filecheck_select_max%]";
	var filemanage_js_album_select_err = "[%$ST.filemanage_js_album_select_err%]";
	var fheight="[%$fheight%]";
	var loadurl="[%$loadurl%]";
	var iframename = "[%$iframename%]";
	var inputtext = "[%$inputtext%]";

	$(document).ready(function(){
		var h = parseInt(fheight);
		$('#mainbodybottonauto').css({height:h-80});
	})

	function refile(){

		var albumlist=$('input:[name="filelist"]').val();
		if(albumlist){
			filename=albumlist.substring(0,albumlist.length-1);
			parent.frames[iframename].document.getElementById(inputtext).value = filename;
			parent.closeifram();
		}else{
			alert(filemanage_js_album_select_err);
			return false;
		}
	}

	function resetwindow(){
		parent.closeifram();
	}

	function alselected(gid,imgpath,setype){
		var gidstr="#"+gid;

		var maxselect=$('input:[name="maxselect"]').val();

		var albumlist=$('input:[name="filelist"]').val();
		if (setype=='selected'){

			if (maxselect<1){
				alert(filemanage_filecheck_select_max);

				var htmlse='<input type="checkbox" id="'+gid+'" name="selectinfoid" value="'+imgpath+'" onclick="alselected(\''+gid+'\',this.value,\'selected\');">';
				$(htmlse).replaceAll("#"+gid);
				return false;
			}

			var htmlse='<input type="checkbox" id="'+gid+'" name="selectinfoid" value="'+imgpath+'" onclick="alselected(\''+gid+'\',this.value,\'unde\');" checked>';
			$(htmlse).replaceAll("#"+gid);

			var nowid=Number(maxselect)-1;
			$('input:[name="maxselect"]').val(nowid);

			var albumlist=albumlist+imgpath+'|';
			$('input:[name="filelist"]').val(albumlist);
		}else{

			var htmlse='<input type="checkbox" id="'+gid+'" name="selectinfoid" value="'+imgpath+'" onclick="alselected(\''+gid+'\',this.value,\'selected\');">';
			$(htmlse).replaceAll("#"+gid);

			var maxnowid=Number(maxselect)+1;
			$('input:[name="maxselect"]').val(maxnowid);

			var albumlist=albumlist.replace(imgpath+"|","");
			$('input:[name="filelist"]').val(albumlist);
		}
	}
</script>
</head>

<body>
<input type="hidden" name="maxselect" value="1"/>
<input type="hidden" name="filelist" value=""/>
<div id="mainwindowhidden">
	<div class="suggestion">
		<span class="sugicon"><span class="strong colorgorning2">[%$ST.position_title%]</span><span class="padding-left5 colorgorningage">[%$ST.templatemain_listwindow_path_mess%][%$templateDIR%][%$dirlist%]</span></span>
	</div>
	<div class="sugtitle-line"></div>
</div>
<div id="mainbodybottonauto">
	<div class="filelist" id="imglist">
	[%if $updirtype==1%]
	<div class="infolist" title="[%$ST.filemanage_view_updir%]">
		<table border="0" style="border-collapse:collapse" width="100%" bordercolor="#FFFFFF" onclick="javascript:document.location='[%$uploadurl%]';">
			<tr>
				<td width="5%"></td>
				<td width="75%" id="left" class="padding-left3"><img src="templates/images/fileicon/dir.png"> /[%$dirlist%]</td>
				<td width="20%" id="infotype">
					<table border="0" style="border-collapse:collapse" bordercolor="#FFFFFF">
						<tr>
							<td><a class="setedit3" id="center" href="[%$uploadurl%]" title="[%$ST.filemanage_view_updir%]" hidefocus="true">[%$ST.filemanage_view_updir%]</a></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</div>
	[%/if%]
	[%if count($array) > 0%]
	[%forlist from=$array key=list%]
	<div class="infolist gallery clearfix"  title="[%$array[list].loadurl2%]">
		[%if $array[list].bottype=='dir'%]
		<table border="0" style="border-collapse:collapse" width="100%" bordercolor="#FFFFFF" onclick="javascript:document.location='[%$array[list].loadurl%]';">
		[%else%]
		<table border="0"  style="border-collapse:collapse" width="100%" bordercolor="#FFFFFF">
		[%/if%]
			<tr>
				<td width="5%">
					[%if $array[list].bottype!='dir'%]
					<input type="checkbox" id="[%$array[list].fid%]" name="selectinfoid" value="[%$array[list].filename%]" onclick="alselected('[%$array[list].fid%]',this.value,'selected');">
					[%/if%]
				</td>
				<td width="75%" id="left" class="padding-left3"><img src="templates/images/fileicon/[%$array[list].type%].png"> [%$array[list].filename%]</td>
				<td width="20%">[%$array[list].time|timeformat(3)%]</td>
			</tr>
		</table>
	</div>
	[%/forlist%]
	[%else%]
	<div class="infolist">
		<table border="0" style="border-collapse:collapse" width="100%" bordercolor="#FFFFFF">
			<tr>
				<td align="center">[%$ST.list_nothing_title%]</td>
			</tr>
		</table>
	</div>
	[%/if%]
	</div>
</div>

<div id="downbotton" style="margin-top: 5px;">
	<div id="subbotton">
		<table border="0" width="100%">
			<tr id="bottonsubmit">
				<td id="right"><input type="submit" name="Submit" id="submitbotton" onclick="javascript:refile();" value="[%$ST.botton_add%]" class="button orange" title="[%$ST.botton_add%]"/></td>
				<td id="left" class="padding-left5"><input type="reset" name="reset" onclick="javascript:resetwindow();" id="release" value="[%$ST.botton_upfile_reset%]" class="button orange"  title="[%$ST.botton_upfile_reset%]" /></td>
			</tr>
		</table>
	</div>
</div>
</body>

</html>      